import axios from "axios"

export default {
    post(name, phone, address, date, storeId, busy) {
        return axios
            .post("/distribution/addDistribution", {
                name, phone, address, date, storeId, busy
            })
            .then(function (response) {
                return response.data
            })
    },
    get(curpage, eachPage) {
        return axios
            .get('/distribution', {
                params: {
                    curpage, eachPage
                }
            })
            .then(function (response) {
                return response.data
            })
    },
    update: (_id, phone, address) => {
        return axios
            .patch("/distribution/updateDistribution", {
                _id, phone, address
            })
            .then(function (response) {
                return response.data
            })
    },
    searchDistribution: (name) => {
        return axios
            .post("/distribution/searchDistribution", {
                name
            })
            .then(function (response) {
                return response.data
            })
    },
    delete: (_id) => {
        return axios
            .delete("/distribution/deleteDistribution", {
                params: {
                    _id
                }
            })
            .then(function (response) {
                return response.data
            })
    },
}